#include <cstdio>
#include <cstring>

//index/2 = father's index
int main(int argc, char const *argv[]){
    int i, j;
    while(scanf("%d %d", &i, &j) != EOF){
        while (i != j){
            if (i > j)
                i /= 2;
            else
                j /= 2;
        }
        printf("%d\n", i);
    }
    return 0;
}
